package com.ruoyi.project.mall.api;


import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bootdo.R;
import com.ruoyi.project.mall.service.MallServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/api/mallServer")
public class ApiMallServerController {
    @Autowired
    private MallServiceService mallServiceService;


    /**
     * 获取各种服务
     * @param params 0关于我们1买家入口2卖家入口3线下支付账号信息4客服投诉
     * @return
     */
    @PostMapping( "/getServers")
    @ResponseBody
    public R getServers(@RequestBody Map<String, Object> params){

        try{
            if (!params.containsKey("status") || StringUtils.isBlank(params.get("status").toString())


            ) {
                return R.error("参数错误");
            }
            return  mallServiceService.getServers(params);
        }catch (Exception e){
            return R.error("服务器网络异常");
        }
    }
}
